package com.nwpu.am.utils;

import org.apache.shiro.crypto.hash.SimpleHash;
import org.apache.shiro.util.ByteSource;


/**
 * MD5Util
 * <p>
 * md加密
 *
 * @author Roy
 * @version 1.0
 * {@code @date} 2024/6/3
 */

public class MD5Util {
    private MD5Util() {
    }

    /**
     * 获取md5加盐加密内容
     *
     * @param inStr
     * @param salt       盐值
     * @param iterations 迭代次数
     * @return
     */
    public static String getMD5AsHexWithSalt(String inStr, ByteSource salt, int iterations) {
        return new SimpleHash("md5", inStr, salt, iterations).toHex();
    }
}
